package com.yc.jpyy.usercertirenew.service.imp;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service;
import com.yc.jpyy.base.service.BaseService;
import com.yc.jpyy.usercertirenew.dao.UserCertiRenewDao;
import com.yc.jpyy.usercertirenew.service.UserCertiRenewService;


@Service
public class UserCertiRenewServiceImpl extends BaseService implements UserCertiRenewService {
 

@Autowired
private UserCertiRenewDao userCertiRenewDao;

@Override
public Map<String, Object> addUserCertiRenew(Map<String, Object> paramsMap)
		throws DataAccessException {
	Map<String,Object> resultMap = new HashMap<>();
	int count = userCertiRenewDao.addUserCertiRenew(paramsMap);
	if(count <= 0){
		resultMap.put("returnCode", 0);
		resultMap.put("returnMsg", "新增失败");
	}else{
		//更新userCertificate表
		int counts = userCertiRenewDao.updateUserCerti(paramsMap);
		if(counts <= 0){
			resultMap.put("returnCode", 0);
			resultMap.put("returnMsg", "操作失败");
		}else{
			resultMap.put("returnCode", 1);
			resultMap.put("returnMsg", "操作成功");
		}
	}
	return resultMap;
}

@Override
public Map<String, Object> selectUserCertiRenew(Map<String, Object> paramsMap)
		throws DataAccessException {
	Map<String,Object> resultMap = new HashMap<>();
	List<Map<String,Object>>  map = userCertiRenewDao.selectUserCertiRenew(paramsMap);
	if(map != null && map.size() > 0){
		resultMap.put("returnCode", 1);
		resultMap.put("ListData", map);
	}else{
		resultMap.put("returnCode", 0);
		resultMap.put("returnMsg", "无数据");
	}
	return resultMap;
}
}
